﻿<%@ page language="java" contentType="text/html;charset=UTF-8"
    pageEncoding="UTF-8"%>
 <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head> 
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Insert title here</title>
<script src="${pageContext.request.contextPath}/js/jquery-1.11.3.min.js" type="text/javascript"></script>
</head>
<body>
	
			<!--
            	描述：菜单栏
            -->
			<div class="container-fluid">
				<div class="col-md-4">
				<%-- 	<img src="${pageContext.request.contextPath}" /> --%>
				</div>
				<div class="col-md-5">
					<center><h2 style="color:#00EE00 ">网上订餐预订系统</h2></center>
				</div>
				<div class="col-md-3" style="padding-top:20px">
					<ol class="list-inline">
					<c:if test="${empty user }">
						<li><a href="${pageContext.request.contextPath }/UserService?method=registUI">注册</a></li>&nbsp|&nbsp
						<li><a href="${pageContext.request.contextPath }/UserService?method=loginUI">登录</a></li>
					</c:if>
					<c:if test="${not empty user }">
						您好！${user.name }
						<li><a href="${pageContext.request.contextPath }/UserService?method=exitUI">注销</a>
						<li><a href="${pageContext.request.contextPath }/order?method=showOrder">我的订单</a></li>
						<li><a href="${pageContext.request.contextPath }/cart?method=getData">购物车</a></li>
					</c:if>
					
					</ol>
				</div>
			</div>
			<!--
            	描述：导航条
            -->
			<div class="container-fluid">
				<nav class="navbar navbar-inverse">
					<div class="container-fluid">
						<!-- Brand and toggle get grouped for better mobile display -->
						<div class="navbar-header">
							<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
								<span class="sr-only">Toggle navigation</span>
								<span class="icon-bar"></span>
								<span class="icon-bar"></span>
								<span class="icon-bar"></span>
							</button>
							<a class="navbar-brand" href="${pageContext.request.contextPath}">首页</a>
						</div>

						<!-- Collect the nav links, forms, and other content for toggling -->
						<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
							<ul class="nav navbar-nav" id="c_ul">
							</ul>
							<form class="navbar-form navbar-right"  action="${pageContext.request.contextPath}/product" method="post">
								<input type="hidden" name="method" value="search">
								<div class="form-group">
									<input name="search" type="text" class="form-control" placeholder="Search">
								</div>
								<button type="submit" class="btn btn-default">Submit</button>
							</form>

						</div>
						<!-- /.navbar-collapse -->
					</div>
					<!-- /.container-fluid -->
				</nav>
			</div>
	<script type="text/javascript">
		$(function(){
			$.post("${pageContext.request.contextPath }/category",{"method":"findAll"},function(obj){
				//alert(obj);
					$(obj).each(function() {
					$("#c_ul").append("<li><a href='${pageContext.request.contextPath }/product?method=findByPage&pageNumber=1&cid="+this.cid+"'>"+this.cname+"</a></li>");
				});
			},"json"); 
		})
	</script>
</body>
</html>